Skip to content

fix(Staging-Mode): Close the container if exitStagingMode throws #24775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 10, 2025

Conversation

markfields
Copy link
Member

@markfields markfields commented Jun 6, 2025

Fixes AB#41363

Description

We have several asserts and throws under the exitStagingMode API, we should close the container if it throws, some of them would leave us in an invalid state.

@Copilot Copilot AI review requested due to automatic review settings June 6, 2025 17:44
@github-actions github-actions bot added the area: runtime Runtime related issues label Jun 6, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves exitStagingMode by ensuring the container is closed when errors occur during the final flush of staged changes.

  • Updated flushing logic: replaced this.outbox.flush() with this.flush() for better clarity.
  • Added a try-catch block in exitStagingMode to catch errors, normalize the error, invoke the container close callback, and rethrow the normalized error.
Comments suppressed due to low confidence (1)

packages/runtime/container-runtime/src/containerRuntime.ts:3458

  • Consider adding an inline comment in the catch block to document why the normalized error is rethrown after invoking this.closeFn. This additional context can improve code readability and maintainability.
} catch (error) {

@github-actions github-actions bot added the base: main PRs targeted against main branch label Jun 6, 2025
@markfields markfields enabled auto-merge (squash) June 6, 2025 18:19
@markfields
Copy link
Member Author

markfields commented Jun 6, 2025

Doh, gotta fix up some test expectations now.

this.flush is incompatible with batchRunner.
I would rather structure orderSequentially to be able to handle staging mode using this.flush,
but it's not the priority right now.
@markfields markfields merged commit 1dbfc16 into microsoft:main Jun 10, 2025
31 checks passed
@markfields markfields deleted the sm/error-handling branch June 10, 2025 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: runtime Runtime related issues base: main PRs targeted against main branch Feature_StagingMode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants